package 第六章作业;

import java.util.Scanner;

public class 作业3 {
    public static void main(String[] args) {
       // (1)产生0~99之间的随机数字:
       // int number = (int)(Math.random()*100)
        int temp=0;
        int number = (int)(Math.random()*100);
        Scanner input=new Scanner (System.in);
        for(int i=0;i<20;i++){
            System.out.println("请输入一个整数：");
            int num=input.nextInt();
            if(num>number) {
                System.out.println("您猜的数字大了");
                temp++;
            }else if(num<number) {
                System.out.println("您猜的数字小了");
                temp++;
            }else {
                System.out.println("您猜对了！");
                temp++;
                break;
            }
        }
        switch (temp) {
            case 1:
                System.out.println("您太有才了");
                break;
            case 2:
                System.out.println("这么快就猜出来了，很聪明！");
            case 3:
                System.out.println("这么快就猜出来了，很聪明！");
            case 4:
                System.out.println("这么快就猜出来了，很聪明！");
            case 5:
                System.out.println("这么快就猜出来了，很聪明！");
            case 6:
                System.out.println("这么快就猜出来了，很聪明！");
                break;
            default:
                System.out.println("这个数是"+number);
                System.out.println("猜了半天才猜出来，小同志，尚需努力啊！");
                break;
        }


    }

}

